
package com.scalar.chiptrack.sales.actions;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.scalar.chiptrack.ChipTrackAction;
import com.scalar.chiptrack.sales.dao.SalesCommissionDAO;
import com.scalar.chiptrack.sales.forms.SalesCommissionForm;


/**
 * Implementation of <strong>Action</strong> that gives customers list,
 * search with customer name, create sales order
 *
 * @author Raj Vallamsetla
 * @version $Revision: 1.1.1.1 $ $Date: 2006/12/11 23:43:17 $
 */

public final class SalesCommissionAction extends ChipTrackAction {


    // ----------------------------------------------------- Instance Variables
        ArrayList viewList  = new ArrayList();
   

    // --------------------------------------------------------- Public Methods


    /**
     * Process the specified HTTP request, and create the corresponding HTTP
     * response (or forward to another web component that will create it).
     * Return an <code>ActionForward</code> instance describing where and how
     * control should be forwarded, or <code>null</code> if the response has
     * already been completed.
     *
     * @param mapping The ActionMapping used to select this instance
     * @param actionForm The optional ActionForm bean for this request (if any)
     * @param request The HTTP request we are processing
     * @param response The HTTP response we are creating
     *
     * @exception Exception if business logic throws an exception
     */
    public ActionForward execute(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)
	throws Exception {

		// Extract attributes and parameters we will need
		SalesCommissionForm salesCommissionForm = (SalesCommissionForm) form;
		String action = request.getParameter("action");
		if(action==null)
                action="";
                if(action.equals("")){
                    SalesCommissionForm salesCommission = SalesCommissionDAO.getSalesCommission();
                    salesCommissionForm.setSalesCommission(salesCommission.getSalesCommission());
                    salesCommissionForm.setType(salesCommission.getType());
                }
		request.setAttribute("salesCommForm",salesCommissionForm);
                               
               
                                
                //Please look at this return later(Where do we need this retrurned) ????
		return (mapping.findForward("success"));

    }

}
